package com.hyl.mapper;

import com.hyl.entity.SysUser;
import com.hyl.vo.SysUserParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * SysUserMapper
 *
 * @author hyl
 * @date 2025-05-26
 */
public interface SysUserMapper {
    //单一条件:基本数据类型 Integer/ String=》SQL使用#{名称没用限制}
    SysUser selectUserById(Integer id);
    SysUser selectUserByName(String username);
    SysUser selectByaccountAndPwd(@Param("account") String account,
                                        @Param("password") String password);

    //单一条件:对象类型=>SQL使用对象的属性名=》#{属性}
    List<SysUser> selectUserByUser(SysUser user);
    List<SysUser> selectUserList(SysUserParam user);

    //多参数：map=》SQL使用key=》#{key}
    List<SysUser> selectUserByMap(Map<String, Object> map);
    //多参数：自定义=》@Param =》SQL使用@Param注解的名称=》#{名称}
    List<SysUser> selectUserByParam(@Param("name") String username,
                                    @Param("sex") Integer sex);


    //持久化操作：CRUD
    int insertUser(SysUser user);
    int updateUser(SysUser user);
    int deleteUserById(Integer id);

    //分页
    List<SysUser> selectUserPage(@Param("offset")Integer offset,
                             @Param("pageSize") Integer pageSize);
    //分页=》计数
    public int selectCount();
}
